﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BrandonHaynes.Membership.Factors.PromptControls
	{
	/// <summary>
	/// A prompt that displays a message, but does not otherwise collect input or query a user
	/// </summary>
	public class MessagePrompt : Control
		{
		/// <summary>
		/// The text message to display in the prompt
		/// </summary>
		public string Text { get; set; }
		/// <summary>
		/// The CSS class of the message and password input
		/// </summary>
		public string CssClass { get; set; }

		public MessagePrompt()
			{ }

		public MessagePrompt(string text)
			: this()
			{ Text = text; }

		public MessagePrompt(string text, string cssClass)
			: this(text)
			{ CssClass = cssClass; }

		public MessagePrompt(IDictionary<string, string> attributes)
			: this(attributes.GetValueOrDefault("text"), attributes.GetValueOrDefault("cssClass", "MessagePrompt"))
			{ }

		protected override void OnInit(EventArgs e)
			{
			base.OnInit(e);

			// Create our message prompt
			var label = new Label() { Text = this.Text, CssClass = this.CssClass };
			Controls.Add(label);
			}
		}
	}
